<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Home</title>
    <link rel="stylesheet" th:href="@{static/css/layui.css}">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">运动会管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">

        </ul>
        <ul class="layui-nav layui-layout-right">
            <div th:if="${session.user}">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <i class="layui-icon layui-icon-user" style="font-size: 15px"></i>
                        <span th:text="${session.user.getNum()}">unknown</span>
                    </a>
                    <dl class="layui-nav-child">
                        <dd th:if="${session.user.getIdentity().equals('2')}"><a th:href="@{userinfo}">基本资料</a></dd>
                        <dd><a th:href="@{/toPage(url=rePassword)}">修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="user/logout">退出</a></li>
            </div>
            <div th:unless="${session.user}">
                <li class="layui-nav-item"><a th:href="@{/toPage(url=login)}">登录</a></li>
            </div>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="test" style="margin-right: 10px;">
                <li class="layui-nav-item"><a href="/sports">主页</a></li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">当前赛况</a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{/toPage(url=scoreSituation)}">田赛</a></dd>
                        <dd><a th:href="@{/toPage(url=scoreSituationJ)}">径赛</a></dd>
                    </dl>
                </li>
                <div th:if="${session.user}">
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('2')}"><a th:href="@{/toPage(url=signup)}">我要报名</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('2')}"><a th:href="@{/toPage(url=myRegistration)}">我的报名</a></li>
                    <li class="layui-nav-item layui-nav-itemed" th:if="${session.user.getIdentity().equals('0') || session.user.getIdentity().equals('1')}">
                        <a href="javascript:;">上传成绩</a>
                        <dl class="layui-nav-child">
                            <dd><a th:href="@{/toPage(url=scoreEntryT)}">田赛</a></dd>
                            <dd><a th:href="@{/toPage(url=scoreEntryJ)}">径赛</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=registrationReview)}">报名审核</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=perManagement)}">人员管理</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=noticeManage)}">公告管理</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=volunteer)}">志愿者名单</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=projectManage)}">项目</a></li>
                </div>
            </ul>
        </div>
    </div>


    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="layui-row">
            <div class="layui-col-md4 layui-col-md-offset5">
                <h1 style="height: 70px;">xxx学校运动会管理系统</h1>
            </div>
        </div>


        <div class="layui-row ">
            <div class="layui-carousel" style="position: relative; left: 12%;" id="test1">
                <div carousel-item>
                    <div><img th:src="@{static/images/img/carousel/img001.png}"></div>
                    <div><img th:src="@{static/images/img/carousel/img002.png}"></div>
                </div>
            </div>
        </div>
        <div class="layui-row ">
                <span style="position: relative;top: 40px;left: 25%;right: 25%;font-size: 16px">
                    欢迎使用本系统,您可以通过本系统进行报名、查看或者对数据进行管理，在使用前请先登录账号,功能正在完善中... ...
                </span>
        </div>

        <div class="layui-row">
            <div style="position: relative;top: 100px;left: 15%;width: 70%">
             <span style="font-size: 22px">
                    公告
                </span>
                <hr class="layui-bg-blue">
                <table id="notice" lay-filter="notice"></table>
            </div>
        </div>
    </div>

</div>

<script th:src="@{static/layui.js}"></script>
<script th:src="@{static/jquery.js}"></script>


<!--控制菜单展开-->
<script>
    layui.use('element', function () {
        var element = layui.element;
        //监听导航点击
        element.on('nav(test)', function (elem) {

        });
    });
</script>

<!--获取公告-->
<script>
    layui.use('table', function () {
        var table = layui.table;
        table.render({
            elem: '#notice'
            , url: 'notice/findAllNoticeInfo' //数据接口
            , page: true
            , cols: [
                [ //表头
                    {field: 'noticeId', title: 'ID', width: 100, fixed: 'left', sort: 'true'}
                    , {field: 'noticeDate', title: 'Date', width: 181}
                    , {field: 'noticeTitle', title: 'Title', width: 818}
                    , {field: 'noticeAuthor', title: 'Author', width: 100}

                ]
            ]
        });
        //监听行单击事件
        table.on('row(notice)', function (obj) {
            var $ = layui.jquery;
            var data = JSON.stringify(obj.data['noticeId']);

            // $.get("notice/findNoticeById",{noticeId: data})
            window.open("notice/findNoticeById?noticeId=" + data);

        });

    });

</script>

<!--轮播图-->
<script>
    layui.use('carousel', function () {
        var carousel = layui.carousel;
        //建造实例
        carousel.render({
            elem: '#test1'
            , width: 1280 //设置容器宽度
            , arrow: 'always' //始终显示箭头
            , height: 280
            //,anim: 'updown' //切换动画方式
        });
    });
</script>

</body>
</html>
